Skip to content

fix invalid pod_id persistence in exec session#475

Open
vivienhenz24 wants to merge 1 commit intorunpod:mainfrom
vivienhenz24:fix/invalid_pod_id
Open

fix invalid pod_id persistence in exec session#475
vivienhenz24 wants to merge 1 commit intorunpod:mainfrom
vivienhenz24:fix/invalid_pod_id

Conversation

@vivienhenz24
Copy link

Other bug: found a gap in get_session_pod() where a user‑entered pod id is never validated before being written to ~/.runpod/pod_id. So that lets typos/stale ids get persisted on later runs, which then forces repeated prompts. Basically stored ids were validated but prompted ones were not.

I added a small validation check to fix

@deanq deanq requested a review from Copilot March 18, 2026 22:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a gap in get_session_pod() where a user-entered pod ID was previously persisted to ~/.runpod/pod_id without validation, leading to stale/typo’d IDs being saved and causing repeated prompts on later runs.

Changes:

  • Validate a prompted pod ID via get_pod() before writing it to ~/.runpod/pod_id.
  • Raise a CLI-facing error when the prompted pod ID is invalid.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

# If file doesn't exist or is empty, prompt user for the pod_id
pod_id = click.prompt("Please provide the pod ID")
if get_pod(pod_id) is None:
raise click.ClickException("Invalid pod ID.")
Comment on lines 32 to 37
pod_id = click.prompt("Please provide the pod ID")
if get_pod(pod_id) is None:
raise click.ClickException("Invalid pod ID.")
os.makedirs(os.path.dirname(POD_ID_FILE), exist_ok=True)
with open(POD_ID_FILE, "w", encoding="UTF-8") as pod_file:
pod_file.write(pod_id)
Comment on lines +33 to +34
if get_pod(pod_id) is None:
raise click.ClickException("Invalid pod ID.")
@@ -30,6 +30,8 @@ def get_session_pod():

# If file doesn't exist or is empty, prompt user for the pod_id
pod_id = click.prompt("Please provide the pod ID")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants